<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="true" EnableTheming="false" Theme="" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Report Viewer</title>
</head>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        string report = Request.QueryString["path"];
        if (string.IsNullOrEmpty(report))
        {
            this.reportViewer.Visible = false;
            Response.Write("No report specified");
            return;
        }
        this.reportViewer.ServerReport.ReportPath = report;
        string controls = Request.QueryString["controls"];
        if (controls == "false" || controls == "0")
        {
            this.reportViewer.ShowToolBar = false;
            this.reportViewer.ShowParameterPrompts = false;
        }
        System.Collections.Generic.List<ReportParameter> rptParams = new System.Collections.Generic.List<ReportParameter>();
        foreach (string key in Request.QueryString.AllKeys)
        {
            if (key != "path" && key != "controls")
            {
                ReportParameter param = new ReportParameter(key, Request.QueryString[key]);
                rptParams.Add(param);
            }
        }
        if (rptParams.Count > 0)
        {
            this.reportViewer.ServerReport.SetParameters(rptParams);
        }
    }
</script>

<body scroll="no" style="margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;">
    <table cellspacing="0" cellpadding="0" width="100%" height="100%">
        <tr>
            <td>
                <form id="form1" runat="server">
                <rsweb:ReportViewer ID="reportViewer" runat="server" ProcessingMode="Remote" Width="100%"
                    Height="100%">
                </rsweb:ReportViewer>
                </form>
            </td>
        </tr>
    </table>
</body>
</html>
